<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    姓名：<input type="text" v-model="person.name"> <br>
    年龄：<input type="text" v-model="person.age"> <button @click="person.age++">+</button> <br>

    <h1>
        {{person.name}}今年{{person.age}}岁了。
    </h1>
</div>
<script>
   var  dataobj= {
       person:{

           name:"柯震南",
           age:21

       }
   };



    var vm = new Vue({
        el:"#app",
       data:dataobj,
        watch:{

            person:{
                deep:true,
                handler(val){
                    console.log(val.name);
                    console.log(val.age);
                }
            }

        }




    })

</script>


</body>
</html>